package org.xxd.kafka.clients.common.network;

/**
 * @author: XiaoDong.Xie
 * @create: 2020-09-28 09:26
 * @description: KafkaChannel构造器
 */
public class ChannelBuilders {

    private ChannelBuilders() { }


    public static ChannelBuilder create() {
        ChannelBuilder channelBuilder;

      /*  switch (securityProtocol) {
            case SSL:
                requireNonNullMode(mode, securityProtocol);
                channelBuilder = new SslChannelBuilder(mode);
                break;
            case SASL_SSL:
            case SASL_PLAINTEXT:
                requireNonNullMode(mode, securityProtocol);
                if (loginType == null)
                    throw new IllegalArgumentException("`loginType` must be non-null if `securityProtocol` is `" + securityProtocol + "`");
                if (mode == Mode.CLIENT && clientSaslMechanism == null)
                    throw new IllegalArgumentException("`clientSaslMechanism` must be non-null in client mode if `securityProtocol` is `" + securityProtocol + "`");
                channelBuilder = new SaslChannelBuilder(mode, loginType, securityProtocol, clientSaslMechanism, saslHandshakeRequestEnable);
                break;
            case PLAINTEXT:
            case TRACE:
                channelBuilder = new PlaintextChannelBuilder();
                break;
            default:
                throw new IllegalArgumentException("Unexpected securityProtocol " + securityProtocol);
        }*/
        channelBuilder = new PlaintextChannelBuilder();
        channelBuilder.configure(null);
        return channelBuilder;
    }
}
